<?php
namespace app\member\controller;
use app\AdminRest;
use app\member\model\Goods;
use app\member\model\RightsRelation;
use longbingcore\wxcore\WxSetting;
use think\App;
use app\member\model\Rights as model;



class AdminRights extends AdminRest
{

    protected $model;


    public function __construct(App $app) {

        parent::__construct($app);

        $this->model = new model();

    }


    /**
     * @author chenniang
     * @DataTime: 2020-07-15 10:49
     * @功能说明:权益列表
     */
    public function rightsList(){

        $this->model->initData($this->_uniacid);

        $input = $this->_param;

        $dis[] = [

            'uniacid' ,'=', $this->_uniacid
        ];

        $dis[] = ['status' ,'>', -1];

        $data = $this->model->rightsList($dis,$input['limit']);

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2020-07-15 14:16
     * @功能说明:添加权益
     */
    public function rightsAdd(){

        $input = $this->_input;

        $input['uniacid'] = $this->_uniacid;

        $res = $this->model->rightsAdd($input);

        return $this->success($res);

    }


    /**
     * @author chenniang
     * @DataTime: 2020-07-15 11:21
     * @功能说明:权益详情
     */
    public function rightsInfo(){

        $input = $this->_param;

        $dis = [

            'id' => $input['id']
        ];

        $data = $this->model->rightsInfo($dis);

        if(empty($data)){

            $this->errorMsg('数据未找到');
        }

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2020-07-15 13:24
     * @功能说明:
     */
    public function rightsUpdate(){

        $input = $this->_input;

        $dis = [

            'id' => $input['id']
        ];

        $data = $this->model->rightsUpdate($dis,$input);

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2020-07-15 13:24
     * @功能说明:上下架
     */
    public function rightsStatusUpdate(){

        $input = $this->_input;

        $dis = [

            'id' => $input['id']
        ];

        $data = $this->model->rightsUpdate($dis,$input);

        return $this->success($data);

    }












}
